Cosmological N-Body simulations are used for a variety of applications. Indeed progress in the study of large scale structures and galaxy formation would have been very limited without this tool. For nearly twenty years the limitations imposed by computing power forced simulators to ignore some of the basic requirements for modeling gravitational instability. One of the limitations of most cosmological codes has been the use of a force softening length that is much smaller than the typical inter-particle separation. This leads to departures from collisionless evolution that is desired in these simulations. We propose a particle based method with an adaptive resolution where the force softening length is reduced in high density regions while ensuring that it remains well above the local inter-particle separation. The method, called the Adaptive TreePM, is based on the TreePM code. We present the mathematical model and an implementation of this code, and demonstrate that the results converge over a range of options for parameters introduced in generalizing the code from the TreePM code. We explicitly demonstrate collisionless evolution in collapse of an oblique plane wave. We compare the code with the fixed resolution TreePM code and also an implementation that mimics adaptive mesh refinement methods and comment on the agreement, and disagreements in the results. We find that in most respects the ATreePM code performs at least as well as the fixed resolution TreePM in highly over-dense regions, from clustering and number density of haloes, to internal dynamics of haloes. We also show that the adaptive code is faster than the corresponding high resolution TreePM code.